#!/bin/bash

# Replace these three settings.
#PROJDIR="/Users/apple/Develop/projects/diantu"
PROJDIR="$PWD"
PIDFILE="$PROJDIR/valk.pid"
LOG_DIR="$PROJDIR/log"

export DIANTU_HOME="$PWD"
echo $DIANTU_HOME

cd $PROJDIR
if [ -f $PIDFILE ]; then
    kill `cat -- $PIDFILE`
    rm -f -- $PIDFILE
fi

if [ -d $LOG_DIR ]; then
    rm -rf -- $LOG_DIR
fi

touch -- $PIDFILE
mkdir -- $LOG_DIR

exec python ./manage.py runfcgi method=threaded host=127.0.0.1 port=8000 pidfile=$PIDFILE
